#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>
#include <unordered_map>

using namespace std;
using LL = long long;
const int N = 2e5 + 10;

/*
we can find the number which has the biggest quantity
and change other number into it

*/

int n;
int q[N];

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    unordered_map<int, int> mp;
    

    cin >> n;
    for(int i = 1; i <= n; i ++){
        cin >> q[i];
        if(!mp.count(q[i])){
            mp[q[i]] = 1;
        }else{
            mp[q[i]] ++;
        }
    }

    int cnt = -1, maxv;
    for(auto &[key, val] : mp){
        if(val > cnt){
            cnt = val;
            maxv = key;
        }
    }

    vector<int> idx;
  
    for(int i = 1; i <= n; i ++){
        if(q[i] == maxv) idx.push_back(i);
    }
    idx.push_back(n + 1);

    // for(int i = 0; i < idx.size(); i ++) cout << idx[i] << " ";
    // cout << '\n';

    cout << n - cnt << '\n';

    for(int i = idx[0]; i > 1; i --){
        if(q[i - 1] > maxv) cout << 2 << " " << i - 1 << " " << i << '\n';
        else cout << 1 << " " << i - 1 << " " << i << '\n';
    }

    for(int i = 0; i + 1 < idx.size(); i ++){
        int fo = idx[i], ed = idx[i + 1];
        for(int j = fo + 1; j < ed; j ++){
            if(q[j] > maxv){
                cout << 2 << " " << j << " " << j - 1 << '\n';
            }else{
                cout << 1 << " " << j << " " << j - 1 << '\n';
            }
        }
    }
    return 0;
}